<template>
  <div class="grandSon">
    <p>孙子组件2</p>
    <div>祖父的钱:{{ money }}w</div>
    <div>祖父的车:{{ cars.name }}</div>
    <button @click="changeMoney(2)">花钱</button>
  </div>
</template>

<script setup lang="ts" name="Garndson2">
import { inject } from "vue";
const { money, changeMoney } = inject("parentMony",{money:0,changeMoney:(_value:number)=>{}});
const cars = inject("parentCars", { name: "jeep", price: 520 });
</script>

<style scoped lang="scss">
.grandSon {
  background-color: orange;
  padding: 10px;
}
</style>
